package com.samuel;


import com.samuel.aspect.DemoAnnocationService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @date:2017/11/21
 * @time: 11:46
 * @author:zhaoyang
 * @desc:启动Spring
 **/
public class SpringApplication {


    public static void main(String[] args) {

        // 获取Spring注解配置类的上下文
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);

        //dependency inject 调用 UseHelloWorldBean bean
       /* UseHelloWorldBean useHelloWorldBean = context.getBean(UseHelloWorldBean.class);
        System.out.println(useHelloWorldBean.sayHello("<>Sameul<>"));*/

        DemoAnnocationService demoAnnocationService = context.getBean(DemoAnnocationService.class);
        demoAnnocationService.add();



      /*  DemoMethodService demoMethodService = context.getBean(DemoMethodService.class);
        demoMethodService.add();*/

        //关闭上下文
        context.close();
    }

}
